﻿namespace TestTool.Tests.Common.CommonUtils
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Runtime.CompilerServices;
    using TestTool.Tests.Definitions.Enums;

    public static class FeatureUtils
    {
        public static bool ContainsFeature(this IEnumerable<Feature> features, Feature feature)
        {
            switch (feature)
            {
                case Feature.PTZAbsoluteOrRelativePanTilt:
                    return (features.Contains<Feature>(Feature.PTZAbsolutePanTilt) || features.Contains<Feature>(Feature.PTZRelativePanTilt));

                case Feature.PTZAbsoluteOrRelativeZoom:
                    return (features.Contains<Feature>(Feature.PTZAbsoluteZoom) || features.Contains<Feature>(Feature.PTZRelativeZoom));

                case Feature.MediaOrReceiver:
                    return (features.Contains<Feature>(Feature.MediaService) || features.Contains<Feature>(Feature.ReceiverService));

                case Feature.H264OrMPEG4:
                    return (features.Contains<Feature>(Feature.H264) || features.Contains<Feature>(Feature.MPEG4));

                case Feature.PTZAbsoluteOrRelative:
                    return (features.Contains<Feature>(Feature.PTZAbsolute) || features.Contains<Feature>(Feature.PTZRelative));
            }
            return features.Contains<Feature>(feature);
        }
    }
}

